package com.wf.controller;

import com.wf.domain.PaymentManage;
import com.wf.domain.User;
import com.wf.dto.PayVO;
import com.wf.service.PaymentManageService;
import com.wf.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Objects;

/**
 * @Author: zhiyu
 * @Date:18:32
 * @DESC:
 */
@Api("线上收费控制层")
@RestController
@CrossOrigin
public class PaymentController {
    @Autowired
    private PaymentManageService paymentManageService;
    @GetMapping("/selectConPayList")
    @ApiOperation("动态查询付款信息")
    public Result selectConPayList(@RequestParam(required = false)Long houses_id,@RequestParam(required = false)Long user_id,@RequestParam(required = false) Integer contract_id){
        List<PayVO> payvos = paymentManageService.selectAllPay(houses_id,user_id,contract_id);
        return Result.success(payvos);
    }
    @GetMapping("/selectPayMess")
    @ApiOperation("根据房间查询付款详细信息")
    public Result selectPayMess(@RequestParam(required = false)Long houses_id){
        List<PaymentManage> paymentManages = paymentManageService.selectPayMess(houses_id);
        return Result.success(paymentManages);
    }
    @PostMapping("/pullBill")
    public Result pullBill(@RequestBody HashMap<String, Object> map){
        System.out.println("bills = " + map);
        boolean b = paymentManageService.pullBill(map);
        return Result.success(b);
    }
}
